package com.qk.ezbuy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qk.ezbuy.dao.ProductCategoryMapper;
import com.qk.ezbuy.pojo.News;
import com.qk.ezbuy.pojo.ProductCategory;
import com.qk.ezbuy.service.ProductCategoryService;
import com.qk.ezbuy.service.ProductService;
import com.qk.ezbuy.dao.ProductCategoryMapper;
import com.qk.ezbuy.pojo.ProductCategory;
import com.qk.ezbuy.service.ProductCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductCategoryServiceImpl implements ProductCategoryService {

    @Autowired
    private ProductCategoryMapper productCategoryMapper;

    @Override
    public PageInfo<ProductCategory> selectAll(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ProductCategory> list = productCategoryMapper.selectAll();
        PageInfo<ProductCategory> pageInfo = new PageInfo<ProductCategory>(list,3);
        return pageInfo;
    }

    @Override
    public int delProductCategoryById(int id) {
        return productCategoryMapper.delProductCategoryById(id);
    }

    @Override
    public List<ProductCategory> selectProductCategoryAll() {
        return productCategoryMapper.selectProductCategoryAll();
    }

    @Override
    public int insertSelective(ProductCategory record) {
        return productCategoryMapper.insertSelective(record);
    }

    public List<ProductCategory> selectAll() {
        return productCategoryMapper.selectAll();
    }

    @Override
    public List<ProductCategory> selectProductCategoryByType(int type) {
        return productCategoryMapper.selectProductCategoryByType(type);
    }

    @Override
    public int updateByPrimaryKeySelective(ProductCategory record) {
        return productCategoryMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public ProductCategory selectProductCategoryById(int id) {
        return productCategoryMapper.selectProductCategoryById(id);
    }
}
